using System;

namespace SmartSite.Network
{
    public class SocketErrorEventArgs : SocketStateEventArgs
    {

        public string ErrorMessage { get; }

        public SocketErrorEventArgs(SocketStateEventArgs state, string message) :
        base(CheckingState(state, nameof(state)).Socket, state.RemoteEndPoint, state.GetBuffer())
        {
            ErrorMessage = message;
        }

        static SocketStateEventArgs CheckingState(SocketStateEventArgs state, string name)
            => state ?? throw new ArgumentNullException(name);
    }
}